package com.example.front.controller;

import com.example.common.dto.JsonResult;
import com.example.common.dto.ListDto;
import com.example.common.dto.Pagination;
import com.example.front.dto.*;
import com.example.front.serivce.IncidentService;
import com.example.interceptor.UserContext;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

@Api(tags = "严重等级")
@RestController
@CrossOrigin
@RequestMapping("/front/panel/list")
public class PanelController {

    @Resource
    IncidentService incidentService;

    @ApiOperation("统计呼叫次数")
    @GetMapping("/eventimes")
    public JsonResult<ListDto<EventTimesDto>> list(@Valid IncidentSearchDto condition, Pagination pagination) {
        condition.setTenantId(UserContext.getUser().getTenantId());
        ListDto<EventTimesDto> incidentDtoList = incidentService.evenTimes(condition, pagination);

        return new JsonResult<>(incidentDtoList);
    }
}
